﻿/*---------------------------------------------------------------- 
// Copyright 2005-2016 My Tech. Co. Ltd. All Rights Reserved.
// 版权所有。  
// 
// 文件名： CradleHeadBll
// 文件功能描述： 
// 
//  
// 创建标识： wx2016/11/11 16:38:35
// 
// 修改标识： 
// 修改描述： 
//----------------------------------------------------------------*/

//using AxVZLPRClientCtrlLib;
using MyBLL.Dto;
using MyDAL.DAL.Biz;
using MyDAL.DAL.Dto.DeviceDto;
using MyDAL.DAL.Dto.SystemDto;
using MyMiddleware;
using MyMiddleware.Radars.SP100;
using MyMiddleware.Readers;
using MyMiddleware.SocketDev;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace MyBLL
{
    public class MainBll
    {
        List<DeviceDto> deviceList;
        bool isListening = false;
        Dictionary<string, List<Reader>> readerDic = new Dictionary<string, List<Reader>>();
        Dictionary<string, List<MyClient>> controlDic = new Dictionary<string, List<MyClient>>();
        //Dictionary<string, List<AxVZLPRClientCtrl>> cameraDic = new Dictionary<string, List<AxVZLPRClientCtrl>>();

        //public void StartListening(List<DeviceDto> deviceList,Dictionary<string, UserControl1)
        //{
        //    this.deviceList = deviceList;

        //    Thread listeningTh = new Thread(Listening);
        //    isListening = true;
        //    listeningTh.IsBackground = true;
        //    listeningTh.Start();
        //}

        public static MainBll GetInstence()
        {
            return new MainBll();
        }

        
        /// <summary>
        /// 开启设备监听
        /// </summary>
        private void Listening()
        {
            while(isListening)
            {
                for(int i=0;i<deviceList.Count;i++)
                {

                    //if (deviceList[i].UseCamera1 == 1)
                    //{
                        
                    //    if (deviceList[i].CameraShow == 0)
                    //    {

                    //    }
                    //}

                    //if (deviceList[i].UseCamera1 == 1)
                    //{
                    //    if(deviceList[i].UseCamera2==1)
                    //    {

                    //    }
                    //}
                    //if(deviceList[i].UseReader1==1)
                    //{
                    //    Reader reader = new Reader();
                    //    ReaderDto rd = new ReaderDto();
                    //    rd.Ip = deviceList[i].ReaderIp1;
                    //    rd.Antcnt = 1;
                    //    reader.DeviceDto = rd;
                    //    reader.OnGetData += Reader_OnGetData;
                    //}
                    //if(deviceList[i].UseControl1==1)
                    //{

                    //}
                    //if(deviceList[i].UseReader2==1)
                    //{

                    //}
                    //if(deviceList[i].UseControl2==1)
                    //{

                    //}
                }
            }
        }

        private void Reader_OnGetData(object sender, DataEventArgs args)
        {
            throw new NotImplementedException();
        }
    }
}
